package com.fred.learning.springbootdubbosampleconsumer;

import com.fred.learning.spring.boot.dubbo.sample.api.ISayHelloService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@SpringBootApplication
public class SpringBootDubboSampleConsumerApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringBootDubboSampleConsumerApplication.class, args);
    }

    @DubboReference(version = "2.0", protocol = "dubbo", loadbalance = "consistenthash")
    ISayHelloService sayHelloService;

    @GetMapping("say")
    public String say() {

        return sayHelloService.say("fred");
    }

}
